import request from '@/utils/request'

const baseUrl = '/prot/company'

export function getCompanyPage(params) {
  return request({
    url: `${baseUrl}`,
    method: 'get',
    params: params
  })
}

export function getCompanyById(id) {
  return request({
    url: `${baseUrl}/${id}`,
    method: 'get'
  })
}

export function saveCompany(company) {
  return request({
    url: `${baseUrl}`,
    method: 'post',
    data: company
  })
}

export function updateCompany(company) {
  return request({
    url: `${baseUrl}`,
    method: 'put',
    data: company
  })
}
export function deleteCompanyById(id) {
  return request({
    url: `${baseUrl}/${id}`,
    method: 'delete'
  })
}

export function deleteCompanyBatch(ids) {
  return request({
    url: `${baseUrl}/batch`,
    method: 'delete',
    params: { ids: ids }
  })
}

export function updateSort(params) {
  return request({
    url: `${baseUrl}/updateSort/${params.companyId}/${params.type}`,
    method: 'put',
  })
}

